with Ada.Text_Io; use Ada.Text_Io;
with Rational_Numbers;

package body Rational_Numbers is
   -- to construct a rational number
   function "/" (X, Y : Integer ) return Rational is
      Res : Rational;
   begin
      declare
      begin
         if ( Y = 0 ) then
            raise Not_A_Rational;
         else if (Y < 0) then
            Res.Numerator := -X;
            Res.Denominator := -Y;
         else -- tout est bon
            Res.Numerator := X;
            Res.Denominator := Y;
         end if;
         end if;
      exception
         when Not_A_Rational =>
            Put_Line("Denominator is not a positive integer");
         when others =>
            null;
      end;
      return Res;
   end "/";
end Rational_Numbers;
